package com.twu.biblioteca;

import java.io.PrintStream;
import java.util.ArrayList;
import java.util.HashMap;

public class Library {
    PrintStream printStream;

    HashMap<String, Boolean> libCollection;

    public Library(PrintStream printStream, ArrayList<String> bookList){
        libCollection = new HashMap<String, Boolean>();
        this.printStream = printStream;
        for (String title : bookList)
            libCollection.put(title, true);
    }

    public void displayAllBooks() {
        for(String book : libCollection.keySet()){
            printStream.println(book);
        }
    }

    public void reserveBook(String title) {
        if (!libCollection.isEmpty() && libCollection.get(title) != null)
            printStream.println("Thank you! Enjoy the book.");
        else
            printStream.println("Sorry we don't have that book yet.");
    }


}
